<?php

namespace app\admin\controller;

use think\Controller;
use think\Db;

class Index extends Controller
{
    public function __construct()
    {
        parent::__construct();
        if(!session('name')){
            $this->redirect("/admin/login/login");
        }
    }
    public function index(){
        $userCount=Db::name('user')->count();
        $proCount=Db::name('project')->count();
        $bookCount=Db::name('book')->count();
        $buyCount=Db::name('pay')->where('pay_payed',1)->count();
        $head=[
            'userCount'=>$userCount,
            'proCount'=>$proCount,
            'bookCount'=>$bookCount,
            'buyCount'=>$buyCount
        ];
        $this->assign('head',$head);
       return $this->fetch();
    }
}
